' This script will create a new target document which is 4 inch x 4 inch document,
' select the contents of the source document and copy it to the clipboard,
' and then paste the contents of the clipboard into the target document.
' Notice that the script sets the active document prior to doing the cut
' and paste because these operations only work on the active document.

Private Sub Command1_Click()
Dim appRef As Photoshop.Application
Dim docRef As Photoshop.Document
Dim docRef2 As Photoshop.Document
Dim newLayerRef As Photoshop.ArtLayer

' now create a new document and copy and paste.
Set appRef = CreateObject("Photoshop.Application")
If (appRef.Documents.Count > 0) Then

    appRef.Preferences.RulerUnits = psInches

    Set docRef = appRef.ActiveDocument
    
    Set docRef2 = appRef.Documents.Add(4, 4, 72, "The New Document")
    
    appRef.ActiveDocument = docRef
    docRef.Selection.SelectAll
    
    docRef.Selection.Copy
    
    appRef.ActiveDocument = docRef2
    
    Set newLayerRef = docRef2.Paste

End If

End Sub
